package com.jargonee.activities;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.jargonee.adapters.JargoneeArrayAdapter;
import com.jargonee.threads.BackendThread;
import com.jargonee.threads.BackendThread.BackendThreadMessages;
import com.jargonee.threads.BackendThread.BackendThreadModes;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ListActivity;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.location.Address;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.Parcelable;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;

public abstract class JargoneeDisplay extends Activity {
	
	private ListView definitionList;
	private LinearLayout radiusChangeButtonHandler;
	private Button decreaseButton;
	private Button increaseButton;
	
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	}
	
	private void startInput() {
		/*Intent jargoneeInput = new Intent(this, JargoneeInput.class);
		startActivity(jargoneeInput);*/
	}
	
	private void displayResults(JSONObject jsonObject) {
		
		
		/*JSONArray localeList = new JSONArray();
		try {
			localeList = jsonObject.getJSONArray("locales");
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		JSONArray definitionList = new JSONArray();
		try {
			definitionList = jsonObject.getJSONArray("objects");
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		List<JSONObject> definitions = new ArrayList<JSONObject>();
		for(int definitionListIndex=0; definitionListIndex<definitionList.length(); definitionListIndex++) {
			try {
				definitions.add(definitionList.getJSONObject(definitionListIndex));
			} catch (JSONException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		
		// add padding jsonObject for first fake row
		definitions.add(0, new JSONObject());
		
		
		//setListAdapter(new JargoneeArrayAdapter<JSONObject>(this, android.R.layout.simple_list_item_1, definitions));

		  ListView lv = getListView();
		  lv.setTextFilterEnabled(true);

		  lv.setOnItemClickListener(new OnItemClickListener() {
		    public void onItemClick(AdapterView<?> parent, View view,
		        int position, long id) {
		      // When clicked, show a toast with the TextView text
		      Toast.makeText(getApplicationContext(), ((TextView) view).getText(),
		          Toast.LENGTH_SHORT).show();
		    }
		  });*/

	}

}
